import 'package:json_annotation/json_annotation.dart';

import '../item_style.dart';
import '../line_style.dart';
import '../tooltip.dart';
import 'series.dart';

part 'line_series.g.dart';

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class LineEmphasis {
  var id;
  var scale;
  var focus;
  var blurScope;
  SeriesLabel? label;
  LabelLine? labelLine;
  SeriesItemStyle? itemStyle;
  LineStyle? lineStyle;
  SeriesAreaStyle? areaStyle;
  SeriesLabel? endLabel;

  LineEmphasis(
      {this.id,
      this.scale,
      this.focus,
      this.blurScope,
      this.label,
      this.labelLine,
      this.itemStyle,
      this.lineStyle,
      this.areaStyle,
      this.endLabel});

  factory LineEmphasis.fromJson(Map<String, dynamic> json) =>
      _$LineEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$LineEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class LineBlurSelect {
  SeriesLabel? label;
  LabelLine? labelLine;
  SeriesItemStyle? itemStyle;
  LineStyle? lineStyle;
  SeriesAreaStyle? areaStyle;
  SeriesLabel? endLabel;

  LineBlurSelect(
      {this.label,
      this.labelLine,
      this.itemStyle,
      this.lineStyle,
      this.areaStyle,
      this.endLabel});

  factory LineBlurSelect.fromJson(Map<String, dynamic> json) =>
      _$LineBlurSelectFromJson(json);

  Map<String, dynamic> toJson() => _$LineBlurSelectToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class LineBlurSelectEmphasis {
  SeriesLabel? label;
  ItemStyle? itemStyle;

  LineBlurSelectEmphasis({this.label, this.itemStyle});

  factory LineBlurSelectEmphasis.fromJson(Map<String, dynamic> json) =>
      _$LineBlurSelectEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$LineBlurSelectEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class LineData {
  var name;
  var value;
  var symbol;
  var symbolSize;
  var symbolRotate;
  var symbolKeepAspect;
  var symbolOffset;
  SeriesLabel? label;
  LabelLine? labelLine;
  ItemStyle? itemStyle;
  LineBlurSelectEmphasis? emphasis;
  LineBlurSelectEmphasis? blur;
  LineBlurSelectEmphasis? select;
  Tooltip? tooltip;

  LineData(
      {this.name,
      this.value,
      this.symbol,
      this.symbolSize,
      this.symbolRotate,
      this.symbolKeepAspect,
      this.symbolOffset,
      this.label,
      this.labelLine,
      this.itemStyle,
      this.emphasis,
      this.blur,
      this.select,
      this.tooltip});

  factory LineData.fromJson(Map<String, dynamic> json) =>
      _$LineDataFromJson(json);

  Map<String, dynamic> toJson() => _$LineDataToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class LineSeries extends Series {
  var id;
  var type = 'line';
  var name;
  var coordinateSystem;
  var xAxisIndex;
  var yAxisIndex;
  var polarIndex;
  var symbol;
  var symbolSize;
  var symbolRotate;
  var symbolKeepAspect;
  var symbolOffset;
  var showSymbol;
  var showAllSymbol;
  var legendHoverLink;
  var stack;
  var cursor;
  var connectNulls;
  var clip;
  var step;

  SeriesLabel? label;
  SeriesLabel? endLabel;
  LabelLine? labelLine;
  LabelLayout? labelLayout;
  SeriesItemStyle? itemStyle;
  LineStyle? lineStyle;
  SeriesAreaStyle? areaStyle;
  LineEmphasis? emphasis;
  LineBlurSelect? blur;
  LineBlurSelect? select;
  var selectedMode;
  var smooth;
  var smoothMonotone;

  var dimensions;
  var encode;

  var seriesLayoutBy;
  var datasetIndex;

  List<LineData>? data;
  MarkPoint? markPoint;
  MarkLine? markLine;
  MarkArea? markArea;
  var zlvel;
  var z;
  var silent;

  var animation;
  var animationThreshold;
  var animationDuration;
  var animationEasing;
  var animationDelay;
  var animationDurationUpdate;
  var animationEasingUpdate;
  var animationDelayUpdate;
  Tooltip? tooltip;

  LineSeries(
      {this.id,
      this.name,
      this.coordinateSystem,
      this.xAxisIndex,
      this.yAxisIndex,
      this.polarIndex,
      this.symbol,
      this.symbolSize,
      this.symbolRotate,
      this.symbolKeepAspect,
      this.symbolOffset,
      this.showSymbol,
      this.showAllSymbol,
      this.legendHoverLink,
      this.stack,
      this.cursor,
      this.connectNulls,
      this.clip,
      this.step,
      this.label,
      this.endLabel,
      this.labelLine,
      this.labelLayout,
      this.itemStyle,
      this.lineStyle,
      this.areaStyle,
      this.emphasis,
      this.blur,
      this.select,
      this.selectedMode,
      this.smooth,
      this.smoothMonotone,
      this.dimensions,
      this.encode,
      this.seriesLayoutBy,
      this.datasetIndex,
      this.data,
      this.markPoint,
      this.markLine,
      this.markArea,
      this.zlvel,
      this.z,
      this.silent,
      this.animation,
      this.animationThreshold,
      this.animationDuration,
      this.animationEasing,
      this.animationDelay,
      this.animationDurationUpdate,
      this.animationEasingUpdate,
      this.animationDelayUpdate,
      this.tooltip});

  factory LineSeries.fromJson(Map<String, dynamic> json) =>
      _$LineSeriesFromJson(json);

  Map<String, dynamic> toJson() => _$LineSeriesToJson(this);
}
